/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.xiaopo.flying.puzzle.ext;

import ohos.agp.utils.Point;

/**
 * 工具类
 *
 * @since 2021-07-30
 */
public class PointF extends Point {
    private float mx;
    private float my;

    /**
     * 构造
     */
    public PointF() {
        super();
    }

    /**
     * 构造
     *
     * @param point
     */
    public PointF(PointF point) {
        mx = point.position[0];
        my = point.position[1];
    }

    /**
     * 构造
     *
     * @param xx
     * @param yy
     */
    public PointF(float xx, float yy) {
        this.mx = xx;
        this.my = yy;
    }

    /**
     * 构造
     *
     * @param dx
     * @param dy
     */
    public final void offset(float dx, float dy) {
        mx += dx;
        my += dy;
    }

    /**
     * 构造
     *
     * @param p
     */
    public final void set(PointF p) {
        this.mx = p.mx;
        this.my = p.my;
    }

    /**
     * 构造
     *
     * @param xx
     * @param yy
     */
    public final void set(float xx, float yy) {
        this.mx = xx;
        this.my = yy;
    }

    @Override
    public float getPointX() {
        return mx;
    }

    @Override
    public float getPointY() {
        return my;
    }

    /**
     * 构造
     *
     * @param xx
     */
    public final void setPointX(float xx) {
        this.mx = xx;
    }

    /**
     * 构造
     *
     * @param yy
     */
    public final void setPointY(float yy) {
        this.my = yy;
    }
}
